<?php
App::uses('AppModel', 'Model');
/**
 * Match Model
 *
 * @property Championship $Championship
 */
class Match extends AppModel {


public $validate = array(
		'championship_id' => array(
			'numeric' => array(
				'rule' => array('numeric'),
				//'message' => 'Your custom message here',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		// 'home' => array(
			// 'numeric' => array(
				// 'rule' => array('numeric'),
			// ),
		// ),
		// 'visitor' => array(
			// 'numeric' => array(
				// 'rule' => array('numeric'),
			// ),
		// ),
		'type' => array(
            'valid' => array(
                'rule' => array('inList', array('Grupo', 'Octavos','Cuartos','Semifinal','Final','Tercer lugar')),
                'message' => 'Selecciona un tipo de partido',
                'allowEmpty' => false
            )
		),
	);
	//The Associations below have been created with all possible keys, those that are not needed can be removed

/**
 * belongsTo associations
 *
 * @var array
 */
	public $belongsTo = array(
		'Championship' => array(
			'className' => 'Championship',
			'foreignKey' => 'championship_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		),
		'home' => array(
			'className' => 'Team',
			'foreignKey' => 'home',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		),
		'visitor' => array(
			'className' => 'Team',
			'foreignKey' => 'visitor'
		)
	);
	
	/**
 * hasMany associations
 *
 * @var array
 */
	public $hasMany = array(
		'Occour' => array(
			'className' => 'Occour',
			'foreignKey' => 'match_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		)
	);
}
